import { defineStore } from "pinia";
import { store } from "@/store/index";

// 创建一个名为 themeStore 的store
const useThemeStore = defineStore({
  id: "theme",
  state: () => ({
    // 默认主题为 light
    currentTheme: "light",
  }),
  actions: {
    // 切换主题的动作
    toggleTheme() {
      this.currentTheme = this.currentTheme === "light" ? "dark" : "light";
      document.documentElement.setAttribute("data-theme", this.currentTheme);
    },
  },
});

export function useThemeStoreWithOut() {
  return useThemeStore(store);
}
